home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / biz / demo / origins.lzh / ARexx / EditGen.rexx < prev    next >
OS/2 REXX Batch file  |  1992-12-23  |  3KB  |  91 lines

  1. /********************************************/
  2. /* Edit a SOURCE or NOTE file from Origins */
  3. /********************************************/
  4.  
  5. /* This script will attempt to load the SOURCE or NOTE file requested by
  6.    Origins into the editor of your choice.  The function may be blocking or
  7.    non-blocking by your choice.  As written, and with the specified editor,
  8.    the function is non-blocking.
  9.  
  10.    When Origins calls this script, it does so in a blocking manner; the
  11.    program won't continue until the script returns.  If you wish this
  12.    behaviour, make the script block until you are done with the file.
  13.    Otherwise, make the script return immediately.
  14.  
  15.    If your editor doesn't do a ScreenToFront() when called, you'll have to
  16.    switch to the editor's screen to see it.
  17.  
  18.    SPECIAL NOTE: If Origins is started from Workbench, and the edit SOURCE
  19.    and NOTE file functions appear not to do anything, the problem may be
  20.    that Origins can't find RX and this script can't find your editor.
  21.  
  22.    If this seems to be the case, the easiest thing to do about it is to move
  23.    RX to C: so that Origins can find it.  If there is still a problem and
  24.    the editor used in this script is not in C:, you can either move it to C:
  25.    or specify an absolute path, i.e. instead of
  26.  
  27.         Editor = 'UEX '     try       Editor = 'SYS:Tools/UEX '
  28.  
  29.    This should clear up any problems with these functions not working
  30.    properly when Origins is started from Workbench.
  31. */
  32.  
  33. /* Enable error handling routines */
  34. Signal On Error
  35. Signal On Syntax
  36. Signal On Halt
  37. Signal On IOErr
  38.  
  39. /* Change this string to the name of your editor */
  40. /* Make sure to include the space after the name */
  41. Editor = 'UEX '
  42.  
  43. /* Change this string to the name of your editor's ARexx port */
  44. /*     Always remember that port names are case-sensitive     */
  45. MyPort = 'URexx'
  46.  
  47. /* Change this string to the name of your editor's ARexx load */
  48. /* command.  Make sure to include the space after the name.   */
  49. Command = 'loadfile '
  50.  
  51. /* Get the name of the file to edit into this variable */
  52. parse arg Filename
  53.  
  54. /* If the editor isn't up, start it */
  55. If (~Show('P',MyPort)) then do
  56.     address command 'run 'Editor Filename
  57.     Exit
  58. End
  59.  
  60. /* Else, set up the address */
  61. address value MyPort
  62.  
  63. /* and tell the editor to load this file */
  64. Command Filename
  65.  
  66. Exit
  67.  
  68. /**********************************************************************/
  69. /*                           Error Handling                           */
  70. /**********************************************************************/
  71.  
  72. Error:
  73.     Parse Source Type Num MacroName Script Prog Port
  74.     say 'ERROR: Macro "'MacroName'", Error: #'RC' ("'ErrorText(RC)'") on line 'SIGL' **'
  75.     exit
  76.  
  77. Syntax:
  78.     Parse Source Type Num MacroName Script Prog Port
  79.     say 'SYNTAX: Macro "'MacroName'", Error: #'RC' ("'ErrorText(RC)'") on line 'SIGL' **'
  80.     exit
  81.  
  82. Halt:
  83.     Parse Source Type Num MacroName Script Prog Port
  84.     say 'HALT: Macro "'MacroName'", Error: #'RC' on line 'SIGL' **'
  85.     exit
  86.  
  87. IOErr:
  88.     Parse Source Type Num MacroName Script Prog Port
  89.     say 'IOERR: Macro "'MacroName'", Error: #'RC' on line 'SIGL' **'
  90.     exit
  91.